home *** CD-ROM | disk | FTP | other *** search
/ Champak 64 / Volume 64 - JOGO DISK .iso / Games / the_best_every_day.swf / scripts / __Packages / Game.as < prev    next >
Text File  |  2008-04-10  |  5KB  |  163 lines

  1. class Game
  2. {
  3.    function Game(l_mcGame)
  4.    {
  5.       trace("-----------------------------------------------");
  6.       trace("Level = " + _global.Pack.nLevel);
  7.       this.mcGame = l_mcGame;
  8.       this.bGamePlaying = true;
  9.       this.bMiniGame = false;
  10.       var _loc3_ = _global.Pack.nLevel;
  11.       while(_loc3_ > 5)
  12.       {
  13.          _loc3_ -= 5;
  14.       }
  15.       this.mcGame.gotoAndStop("Level" + _loc3_);
  16.       this.oLevel = new Level(_global.Pack.nLevel,this.mcGame);
  17.       this.nMiniFunds = Number(830 - 30 * _global.Pack.nLevel);
  18.       this.nTimeBetweenMG = Number(1220 - 20 * _global.Pack.nLevel);
  19.       if(this.nTimeBetweenMG < 400)
  20.       {
  21.          this.nTimeBetweenMG = 400;
  22.       }
  23.       if(this.nMiniFunds < 150)
  24.       {
  25.          this.nMiniFunds = 150;
  26.       }
  27.       this.nTempFund = _global.Pack.nFunds;
  28.       this.nTempIncome = 0;
  29.       this.nTempSpend = 0;
  30.       this.AjustScore(0,"Funds");
  31.       this.AjustScore(0,"Score");
  32.       _global.Pack.unPauseGame();
  33.       trace("nFunds per miss = " + Number(450 + _global.Pack.nLevel * 50));
  34.       trace("pay Per miniGame = " + this.nMiniFunds);
  35.       trace("time Between miniGame = " + this.nTimeBetweenMG);
  36.       trace("-----------------------------------------------");
  37.    }
  38.    function update()
  39.    {
  40.       if(!_global.Pack.bPaused)
  41.       {
  42.          this.oLevel.update();
  43.          this.mcMiniGame.update();
  44.       }
  45.    }
  46.    function addLadder(l_mcLadder)
  47.    {
  48.       this.oLevel.addLadder(l_mcLadder);
  49.    }
  50.    function addFloor(l_mcFloor)
  51.    {
  52.       this.oLevel.addFloor(l_mcFloor);
  53.    }
  54.    function addDropPoint(l_mcDropPoint)
  55.    {
  56.       this.oLevel.addDropPoint(l_mcDropPoint);
  57.    }
  58.    function addPatrick(l_mcPatrick)
  59.    {
  60.       this.oLevel.addPatrick(l_mcPatrick);
  61.    }
  62.    function addObstacle(l_mcObstacle, l_sType)
  63.    {
  64.       this.oLevel.addObstacle(l_mcObstacle,l_sType);
  65.    }
  66.    function removeObstacle(l_mcObstacle)
  67.    {
  68.       this.oLevel.removeObstacle(l_mcObstacle);
  69.    }
  70.    function dropBox(l_bCorrect)
  71.    {
  72.       this.oLevel.dropBox(l_bCorrect);
  73.       if(!l_bCorrect)
  74.       {
  75.          this.AjustScore(Number(-450 - _global.Pack.nLevel * 50),"Funds");
  76.       }
  77.       else
  78.       {
  79.          this.AjustScore(Number(450 + _global.Pack.nLevel * 50),"Score");
  80.       }
  81.    }
  82.    function createLevel()
  83.    {
  84.       _global.Transition.play();
  85.       _global.Transition.TransFunc = function()
  86.       {
  87.          _global.Pack.nLevel = _global.Pack.nLevel + 1;
  88.          _global.GS.gotoAndStop("Game");
  89.       };
  90.    }
  91.    function AjustScore(_Txt, _Kind)
  92.    {
  93.       var _loc4_ = 0;
  94.       if(_Kind == "Score")
  95.       {
  96.          _global.Pack.nScore += _Txt;
  97.          this.mcGame.Hud.nScore_txt.text = _global.Pack.nScore;
  98.       }
  99.       else
  100.       {
  101.          _global.Pack.nFunds += _Txt;
  102.          if(_global.Pack.nFunds < 0)
  103.          {
  104.             this.EndGame(false);
  105.             this.mcGame.Hud.nFunds_txt.text = "$ 0";
  106.          }
  107.          else
  108.          {
  109.             this.mcGame.Hud.nFunds_txt.text = "$ " + _global.Pack.nFunds;
  110.          }
  111.          if(_Txt > 0)
  112.          {
  113.             this.nTempIncome += _Txt;
  114.          }
  115.          else
  116.          {
  117.             this.nTempSpend -= _Txt;
  118.          }
  119.       }
  120.    }
  121.    function EndGame(p_bSuccces)
  122.    {
  123.       this.bGamePlaying = false;
  124.       this.oLevel.oPatrick.ClearControls();
  125.       this.mcGame.FinishScreen.gotoAndPlay("appear");
  126.       if(p_bSuccces)
  127.       {
  128.          this.AjustScore(1000,"Funds");
  129.          if(!_global.Pack.bBonus)
  130.          {
  131.             this.mcGame.FinishScreen.Table.gotoAndStop(1);
  132.          }
  133.          else
  134.          {
  135.             this.mcGame.FinishScreen.Table.gotoAndStop(2);
  136.          }
  137.       }
  138.       else
  139.       {
  140.          _global.MiniGame.ClearControls();
  141.          if(_global.MiniGame._parent._currentframe != 1)
  142.          {
  143.             _global.MiniGame._parent.gotoAndPlay("disapear");
  144.          }
  145.          this.mcGame.FinishScreen.Table.gotoAndStop(3);
  146.       }
  147.       _global.Pack.pauseGame();
  148.    }
  149.    function pasteInfo(p_mcMovie)
  150.    {
  151.       p_mcMovie.nLevel_txt.text = _global.Pack.nLevel;
  152.       p_mcMovie.StartFunds_txt.text = "$ " + this.nTempFund;
  153.       p_mcMovie.FundsEarn_txt.text = "$ " + this.nTempIncome;
  154.       p_mcMovie.FundsSpend_txt.text = "$ " + this.nTempSpend;
  155.       if(_global.Pack.bBonus)
  156.       {
  157.          _global.Pack.nFunds += 100;
  158.          this.mcGame.Hud.nFunds_txt.text = "$ " + _global.Pack.nFunds;
  159.       }
  160.       p_mcMovie.Remain_txt.text = "$ " + _global.Pack.nFunds;
  161.    }
  162. }
  163.